package com.zhy.consumer;

import com.zhy.common.model.User;
import com.zhy.common.service.UserService;
import com.zhy.rpc.proxy.ServiceProxyFactory;

/**
 * @author 随缘而愈
 * @version 1.0
 * @description 消费者启动类
 * @date 24/2/2024 下午3:48
 */

public class ConsumerApplication {
    public static void main(String[] args) {
        //静态代理
        //UserService userService = new UserServiceProxy();

        //动态代理
        UserService userService = ServiceProxyFactory.getProxy(UserService.class);
        User user = new User();
        user.setName("yuan");
        //调用服务
        User demo = userService.getUser(user);
        if (demo != null){
            System.out.println(demo.getName());
        } else {
            System.out.println("user == null");
        }
    }
}
